Problem: In triangle $ABC$, $AB = 10$ and $AC = 17$.  Let $D$ be the foot of the perpendicular from $A$ to $BC$.  If $BD:CD = 2:5$, then find $AD$.
Solution: Let $h = AD$.  Then by Pythagoras on right triangle $ABD$, \[BD^2 = 10^2 - h^2 = 100 - h^2,\]and by Pythagoras on right triangle $ACD$, \[CD^2 = 17^2 - h^2 = 289 - h^2.\][asy]
import graph;

unitsize(0.3 cm);

pair A, B, C, D;

A = (6,8);
B = (0,0);
C = (21,0);
D = (6,0);

draw(A--B--C--cycle);
draw(A--D);

label("$A$", A, dir(90));
label("$B$", B, SW);
label("$C$", C, SE);
label("$D$", D, S);

label("$10$", (A + B)/2, NW);
label("$17$", (A + C)/2, NE);
label("$h$", (A + D)/2, E);
[/asy]

But $BD:CD = 2:5$, so $BD^2 : CD^2 = 4:25$.  Hence, \[\frac{100 - h^2}{289 - h^2} = \frac{4}{25}.\]Solving for $h$, we find $h = \boxed{8}$.